package com.lemon.exam.entity.po;

import com.lemon.exam.common.annotation.LogicDelete;
import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.constraints.NotBlank;
import lombok.Getter;
import lombok.Setter;
import lombok.ToString;
import org.hibernate.validator.constraints.Length;
import org.springframework.data.annotation.Id;
import org.springframework.data.relational.core.mapping.Column;
import org.springframework.data.relational.core.mapping.Table;

import java.io.Serial;
import java.io.Serializable;
import java.time.LocalDateTime;

/**
 * 角色表 持久层对象
 *
 * @author Lemon
 * @since 2025/04/04 14:23:22
 */
@Getter
@Setter
@ToString
@Table(value = "sys_role")
@Schema(name = "角色表")
public class RolePO implements Serializable {
    @Serial
    private static final long serialVersionUID = 1L;

    @Id
    @Schema(description = "主键ID")
    @Column(value = "id")
    private Long id;

    @Schema(description = "名称")
    @Column(value = "name")
    @NotBlank(message = "名称不能为空")
    private String name;

    @Schema(description = "角色权限字符串")
    @Column(value = "role_key")
    @NotBlank(message = "权限字符不能为空")
    @Length(min = 5, max = 10, message = "请输入5~10位的字符")
    private String roleKey;

    @Schema(description = "描述")
    @Column(value = "description")
    private String description;

    @Schema(description = "创建人")
    @Column(value = "create_by")
    private String createBy;

    @Schema(description = "创建时间")
    @Column(value = "create_time")
    private LocalDateTime createTime;

    @Schema(description = "修改人")
    @Column(value = "update_by")
    private String updateBy;

    @Schema(description = "修改时间")
    @Column(value = "update_time")
    private LocalDateTime updateTime;

    @Schema(description = "状态")
    @Column(value = "status")
    private Integer status;

    @Schema(description = "删除状态")
    @Column(value = "deleted")
    @LogicDelete
    private Integer deleted;

}
